package com.shanzmoo.admin.domain.dto;

import cn.hutool.core.bean.BeanUtil;
import com.shanzmoo.base.bean.ValidList;
import com.shanzmoo.db.store.entity.StoreReceiveBillEntity;

import java.time.LocalDateTime;
import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;


/**
 * 仓库收货单 保存对象
 *
 * @author Gzhao 2021-03-11
 */
@Data
@ApiModel("仓库收货单-保存对象")
public class StoreReceiveBillSaveDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotEmpty(message = "关联单号不允许为空")
    @ApiModelProperty(value = "关联单号")
    private String originOrder;

    @NotNull(message = "关联单据类型不允许为空")
    @ApiModelProperty(value = "关联单据类型：1-采购单,2-门店订单,3-售后退货单,4-仓储单")
    private Integer originOrderType;

    @NotNull(message = "收货大仓不允许为空")
    @ApiModelProperty(value = "收货大仓")
    private Integer storeId;

    @ApiModelProperty(value = "备注")
    private String remark;

    @NotEmpty(message = "收货单商品明细不允许为空")
    @ApiModelProperty(value = "收货单商品明细")
    private ValidList<StoreReceiveBillDetailSaveDTO> detailList;

    public StoreReceiveBillEntity convertEntity() {
        StoreReceiveBillEntity target = new StoreReceiveBillEntity();
        BeanUtil.copyProperties(this, target, true);
        return target;
    }
}
